package com.springboot.astra.service.serviceImpl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.springboot.astra.bean.Postmain;
import com.springboot.astra.mapper.PostmainMapper;
import com.springboot.astra.service.PostmainService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class PostmainServiceImpl implements PostmainService {
    @Autowired
    PostmainMapper postmainMapper;

    @Override
    public Postmain getOneById(Integer id) {
        return postmainMapper.getOneById(id);
    }

    @Override
    public IPage<Postmain> getAll(Page<Postmain> page, String query) {
        return postmainMapper.getAll(page,query);
    }

    @Override
    public IPage<Postmain> getAllIsPostReport(Page<Postmain> page, String query) {
        return postmainMapper.getAllIsPostReport(page,query);
    }

    @Override
    public IPage<Postmain> getAllForUser(Page<Postmain> page, String query) {
        return postmainMapper.getAllForUser(page,query);
    }


    @Override
    public List<Postmain> getAllByUserId(Integer id) {
        return postmainMapper.getAllByUserId(id);
    }

    @Override
    public IPage<Postmain> getAllByThemeId(Page<Postmain> page, String query) {
        return postmainMapper.getAllByThemeId(page,query);
    }


    @Override
    public void insertPostmain(Postmain postmain) {
        postmainMapper.insertPostmain(postmain);
    }

    @Override
    public void updateOneById(Postmain postmain) {
        postmainMapper.updateOneById(postmain);
    }

    @Override
    public void updatePostReport(Integer postMainId) {
        postmainMapper.updatePostReport(postMainId);
    }


    @Override
    public void deleteOneById(Postmain postmain) {
        postmainMapper.deleteOneById(postmain);
    }
}
